/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * Storable Interface Definition
 *      Provides a signature and marker interface for SQL objects which may be
 * written to and read from a file or other Stream.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using System.IO;

namespace Adaptive.Foundation
{
	/// <summary>
	/// Provides a signature and marker interface for SQL objects which may be
	/// written to and read from a file or other Stream.
	/// </summary>
	/// <remarks>
	/// In order to allow DOM constructions to be stored, this interface provides
	/// the common signature definitions for reading and writing SQL DOM object
	/// instances.
	/// </remarks>
	public interface IStorable
	{
		/// <summary>
		/// Attempts to save the specific object instance to an open stream.
		/// </summary>
		/// <param name="writer">
		/// An open <see cref="BinaryWriter"/> instance used to write the content
		/// to the open stream.
		/// </param>
		/// <returns>
		/// <b>true</b> if the operation is successful; otherwise, returns <b>false</b>.
		/// </returns>
		bool Save(BinaryWriter writer);
		/// <summary>
		/// Attempts to load the specific object content from an open stream.
		/// </summary>
		/// <param name="reader">
		/// An open <see cref="BinaryReader"/> instance used to reader content
		/// from the open stream.
		/// </param>
		/// <returns>
		/// <b>true</b> if the operation is successful; otherwise, returns <b>false</b>.
		/// </returns>
		bool Load(BinaryReader reader);
	}
}
